import request from "./request";
//获取首页轮播
export const findBanners = ()=>{
    return request({
      url:'/mall-api/index/findBanner'
    })
  }
  //获取一级分类列表
export const getCategory1 = ()=>{
  return request({
    url:'/mall-api/index/findCategory1'
  })
}
// 数据分类层级显示
export const findCategoryTree = ()=>{
  return request({
    url:'/mall-api/index/findCategoryTree',
  })
}
// /mall-api/index/findListGoods
export const findListGoods = ()=>{
  return request({
    url:'/mall-api/index/findListGoods'
  })
}
//  /mall-api/index/findRecommendGoods
export const findRecommendGoods = ()=>{
  return request({
    url:'/mall-api/index/findRecommendGoods'
  })
}
//  /mall-api/goods/list/{page}/{limit}
export const findGoodsList = (params)=>{
  return request({
    url:`/mall-api/goods/list/${params.page}/${params.limit}`,
    data:params,
  })
}
//    /mall-api/weixin/wxLogin/{code}
export const wxLogin = (code) =>{
  return request({
    url:`/mall-api/weixin/wxLogin/${code}`
  })
}

//  /mall-api/weixin/getuserInfo
export const getuserInfo = (code)=>{
  return request({
    url:'/mall-api/weixin/getuserInfo'
  })
}

//  /mall-api/weixin/updateUser
export const updataUser = (params)=>{
  return request({
    url:'/mall-api/weixin/updateUser',
    method:'POST',
    data:params,
  })
}

//    /mall-api/cart/getCartList
export const cartList = ()=>{
  return request({
    url:'/mall-api/cart/getCartList'
  })
}

//  /mall-api/cart/checkCart/{goodsId}/{isChecked}
export const checkCart = (goodsId, isChecked)=>{
  return request({
    url:`/mall-api/cart/checkCart/${goodsId}/${isChecked}`
  })
}
//  /mall-api/cart/delete/{goodsId}
export const deleteGoodsItem = (goodsId)=>{
  return request({
    url:`/mall-api/cart/delete/${goodsId}`
  })
}

//  /mall-api/cart/addToCart/{goodsId}/{count}
export const addToCart = (params)=>{
  return request({
    url:`/mall-api/cart/addToCart/${params.goodsId}/${params.count}`,
    data:params,
  })
}